(:
XQuery that gets listeners from web.xml
:)

declare namespace ns = "http://java.sun.com/xml/ns/j2ee";
<war-listeners>{
let $doc := doc("web.xml")

for $listeners in $doc//ns:listener
let $name := $listeners/ns:listener-class
return

   <listener name="{$name}"></listener>
}</war-listeners>